# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header$

inherit kde-functions eutils

MY_P="${P/_/-}-0-generic-src"
S="${WORKDIR}/CrossVC"

DESCRIPTION="A graphical CVS client."
HOMEPAGE="http://www.crossvc.com"
SRC_URI="http://crossvc.com/download/${MY_P}.tgz"

SLOT="0"
LICENSE="GPL-2"
KEYWORDS="~x86"
IUSE="kde"

DEPEND="kde? ( >=kde-base/kdelibs-3 )
	qt? ( $(qt_min_version 3.3.0) <x11-libs/qt-4 )
	|| ( x11-libs/libX11 virtual/x11 )"

RDEPEND="${DEPEND}
	dev-util/cvs"
need-qt 3

src_compile() {
	${QTDIR}/bin/qmake QMAKE=${QTDIR}/bin/qmake -o Makefile lincvs.pro
	sed -i -e "s/^\tstrip/#\tstrip/" \
		-e "s/CFLAGS   = -pipe -Wall -W -O2/CFLAGS   = ${CFLAGS} -Wall -W/" \
		-e "s/CXXFLAGS = -pipe -Wall -W -O2/CXXFLAGS = ${CXXFLAGS} -Wall -W/" Makefile \
	|| die "sed failed"
	emake || die "make failed"
}

src_install() {
	emake install || die "make install failed"

	echo "#!/bin/sh" > ${S}/CrossVC/crossvc
	echo "exec /usr/share/CrossVC/AppRun" >> ${S}/CrossVC/crossvc
	dobin CrossVC/crossvc
	rm ${S}/CrossVC/crossvc
	dodir /usr/share
	cp -pr ${S}/CrossVC ${D}/usr/share

	dodir /usr/share/pixmaps
	cp ${S}/images/lincvs-16.xpm ${D}/usr/share/pixmaps/crossvc-16.xpm
	make_desktop_entry crossvc "CrossVC" crossvc-16.xpm
	chmod 644 ${D}/usr/share/CrossVC/AppI* ${D}/usr/share/CrossVC/Messages/* \
		${D}/usr/share/CrossVC/Help/* ${D}/usr/share/CrossVC/Help/Translations/*/*
	chmod 755 ${D}/usr/share/CrossVC/AppRun ${D}/usr/share/CrossVC/Tools/*
	dodoc AUTHORS ChangeLog COPYING LICENSE NEWS README THANKS VERSION
}
